Virtual computing environments allow multiple virtual machines (VMs) to be run on a single physical platform and to share physical resources. Some virtual computing environments allow configuring the VMs in a way where the total amount of memory designated for use by the VMs is bigger than the actual amount of memory available on the host. This is referred to as memory over-commitment, and it allows more VMs to be packed onto a single host. Some virtual computing environments permit arbitrary boundaries to be placed around computing resources such as memory that may span more than one host. For example, a virtual computing environment may create two VMs, each configured with 4 GB of memory, from a resource pool potentially spanning multiple hosts and having a memory limit of less than the 8 GB required (e.g., a 7 GB memory limit.)
Consolidation of computing systems, which leads to the opportunity to over-commit computing resources, such as memory, is one of the key benefits of virtualization. In some cases, if a VM is not using all of its allocated machine memory, the VM is charged an idle tax so some machine memory is taken away from the VM and made available to other VMs or other processes running in the host. The virtual infrastructure may utilize a variety of memory management techniques to support memory over-commitment without significant performance cost to applications executing inside the guest. For example, the virtual infrastructure may enable sharing of memory between VMs in cases where VMs may be running instances of the same guest OS and have the same applications, libraries, and other data in common. In this technique, the virtual infrastructure identifies and eliminates redundant copies of guest “physical” memory pages across VMs. The virtual infrastructure maps the identical guest “physical” pages to the same machine memory page and enables copy-on-write behavior with regards to that machine memory page.
Unfortunately, there are applications and runtimes that do not work well with memory over-commitment and page sharing. Java Virtual Machine (JVM) is one of the most widely used runtimes in this category. A JVM runtime can be a problematic candidate for page sharing because a Java application and its associated class data is typically loaded into memory in a non-deterministic manner, often based on the order in which a Java application refers to class data. As a result, though JVMs executing on separate VMs may utilize the same Java class libraries for different applications, the memory pages storing the Java class libraries may be unsuitable for page sharing.